<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title>06.Override Render</title>
  <link rel="stylesheet" href="../_assets/theme.css">
</head>
<body>
  <!-- Layout will be inserted here. -->
  <div class="main"></div>

  <!-- Layout template. -->
  <script class="layout" type="template" id="layout">
    <h1>Hello</h1>
    <p></p>
  </script>

  <!-- Content template. -->
  <script class="template" type="template" id="content">
    This is some content...
  </script>

  <!-- Dependencies. -->
  <script src="../../bower_components/jquery/dist/jquery.js"></script>
  <script src="../../bower_components/underscore/underscore.js"></script>
  <script src="../../bower_components/backbone/backbone.js"></script>

  <!-- LayoutManager library. -->
  <script src="../../backbone.layoutmanager.js"></script>

  <!-- Example code. -->
  <script contenteditable="true">
    // Create a Content view to be used with the Layout below.
    var ContentView = Backbone.Layout.extend({
      template: "#content"
    });

    // Create a new Layout with a sub view for content.
    var layout = new Backbone.Layout({
      template: "#layout",

      // This will place the contents of the Content View into the main
      // Layout's <p></p>.
      views: {
        // Appending a new content view using the array syntax
        p: new ContentView({
          // Custom render function that reverses everything.
          render: function(template, context) {
            return template(context).split("").reverse().join("");
          }
        })
      }
    });

    // Attach the Layout to the main container.
    layout.$el.appendTo(".main");

    // Render the Layout.
    layout.render();
  </script>
</body>
</html>
